/*Resize size of selected item to given maxSize.*/
(function ($) {
$.fn.ATCCResize = function (maxSize) {
if (!maxSize) maxSize = 400;
return this.each(function () {
var $this = jQuery(this);
var width = $this.width();
var height = $this.height();
if (width > maxSize || height > maxSize) {
if (width > maxSize) {
var ratio = height / width;
width = maxSize;
height = maxSize * ratio;
} else {
var ratio = width / height;
height = maxSize;
width = maxSize * ratio;
}
$this.width(width);
$this.height(height);
}
});
}
})(jQuery);
/*watermark in textbox.*/
(function ($) {
$.fn.watermarkText = function (inputSelector) {
return this.each(function () {
var $this = jQuery(this);
if (this.watermarkInputControl) return;
//jQuery.log(this.name);
var nodeName = (this.tagName) ? this.tagName : this.nodeName;
nodeName = nodeName.toLowerCase();
var thisPos = $this.position();
var watermarkcss = "ATCCWatermark ";
if ($this.attr("watermarkcss")) watermarkcss = $this.attr("watermarkcss") + " ";
if ($this.attr("class")) watermarkcss += $this.attr("class");
watermarkcss = watermarkcss.replace(/ATCCToBeWatermark/g, "").replace(/DatePickerInput/g, "");
var newNode = jQuery("<" + nodeName + " class='" + watermarkcss + "' style='display:none'/>")
.insertAfter($this).css("width", $this.width()).css("height", $this.height())
.focus(function () { jQuery(this).hide(); $this.show(); $this.focus(); })
.val($this.attr("title")).attr("tabindex", $this.attr("tabindex"));
this.watermarkInputControl = newNode[0];
function CheckValue(){
if ($this.val() === "") {$this.hide(); jQuery(this.watermarkInputControl).show();}
else if(!$this.is(":visible")){$this.show(); jQuery(this.watermarkInputControl).hide();}
}
$this.blur(CheckValue)
.focus(function () { $this.show(); jQuery(this.watermarkInputControl).hide() })
.trigger("blur")
.attr("title", "");
if($this.hasClass("DatePickerInput"))
$this.change(CheckValue);
});
}
})(jQuery);
jQuery(document).ready(function () {
jQuery("input.ATCCToBeWatermark, textarea.ATCCToBeWatermark").watermarkText();
});
/*Get text out of clicked item and place it in given input.*/
(function ($) {
$.fn.placeTextInTo = function (inputSelector, options) {
if (!options) { options = {}; }
if (!options.sepText) { options.sepText = ""; }
return this.each(function () {
$(this).bind("click", function () {
var text = $(this).text();
$(inputSelector).each(function () { $.ATPlaceText(this, text, options.sepText); });
return false;
});
});
}
///Following method is also used by ATTemplateManager.js
$.ATPlaceText = function (cnt, text, sepText) {
/*IE support*/
if (document.selection) {
cnt.focus();
sel = document.selection.createRange();
sel.text = text + sepText;
}
else if (cnt.selectionStart || cnt.selectionStart == '0') { /*MOZILLA/NETSCAPE support */
var startPos = cnt.selectionStart;
var endPos = cnt.selectionEnd;
cnt.value = cnt.value.substring(0, startPos)
+ text + sepText
+ cnt.value.substring(endPos, cnt.value.length);
} else {
cnt.value += text + sepText;
}
}
})(jQuery);
/**
* --------------------------------------------------------------------
* jQuery-Plugin "pngFix"
* Version: 1.1, 11.09.2007
* by Andreas Eberhard, andreas.eberhard@gmail.com
* http://jquery.andreaseberhard.de/
*
* Copyright (c) 2007 Andreas Eberhard
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
*/
eval(function (p, a, c, k, e, r) { e = function (c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] } ]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(s($){3.1s.1k=s(j){j=3.1a({12:\'1m.1j\'},j);8 k=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 5.5")!=-1);8 l=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 6.0")!=-1);o(3.17.16&&(k||l)){3(2).L("1r[@m$=.M]").z(s(){3(2).7(\'q\',3(2).q());3(2).7(\'p\',3(2).p());8 a=\'\';8 b=\'\';8 c=(3(2).7(\'K\'))?\'K="\'+3(2).7(\'K\')+\'" \':\'\';8 d=(3(2).7(\'A\'))?\'A="\'+3(2).7(\'A\')+\'" \':\'\';8 e=(3(2).7(\'C\'))?\'C="\'+3(2).7(\'C\')+\'" \':\'\';8 f=(3(2).7(\'B\'))?\'B="\'+3(2).7(\'B\')+\'" \':\'\';8 g=(3(2).7(\'R\'))?\'1d:\'+3(2).7(\'R\')+\';\':\'\';8 h=(3(2).1c().7(\'1b\'))?\'19:18;\':\'\';o(2.9.y){a+=\'y:\'+2.9.y+\';\';2.9.y=\'\'}o(2.9.t){a+=\'t:\'+2.9.t+\';\';2.9.t=\'\'}o(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}8 i=(2.9.15);b+=\'\';o(a!=\'\'){b=\'\'+b+\'\'}3(2).1i();3(2).1h(b)});3(2).L("*").z(s(){8 a=3(2).T(\'N-S\');o(a.E(".M")!=-1){8 b=a.X(\'1g("\')[1].X(\'")\')[0];3(2).T(\'N-S\',\'1f\');3(2).Q(0).Y.J="I:H.r.G(m=\'"+b+"\',D=\'F\')"}});3(2).L("1e[@m$=.M]").z(s(){8 a=3(2).7(\'m\');3(2).Q(0).Y.J=\'I:H.r.G\'+\'(m=\\\'\'+a+\'\\\', D=\\\'F\\\');\';3(2).7(\'m\',j.12)})}1t 3}})(3);', 62, 92, '||this|jQuery||||attr|var|style|||||||||||||src|navigator|if|height|width|Microsoft|function|padding|px|appVersion|margin|span|border|each|class|alt|title|sizingMethod|indexOf|scale|AlphaImageLoader|DXImageTransform|progid|filter|id|find|png|background|display|appName|get|align|image|css|parseInt|block|inline|split|runtimeStyle|Explorer|Internet|relative|blankgif|position|MSIE|cssText|msie|browser|hand|cursor|extend|href|parent|float|input|none|url|after|hide|gif|pngFix|transparent|blank|line|pre|space|white|img|fn|return'.split('|'), 0, {}))
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
}
jQuery.fn.extend({
dataWithTrigger: function( key, value ) {
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
var args = [ parts[0], value ];
this.triggerHandler( "setData" + parts[1], args );
this.data(key, value);
this.triggerHandler( "changeData" + parts[1], args );
}
});
function setDropdownStyle(scope) {
if (!jQuery.fn.chosen) return;
var $combobox = jQuery(".chzn-select", scope || document.body).not(".converted");
$combobox.addClass("converted").chosen();
}